package com.frank.easyexcel.serive;

import com.frank.easyexcel.entity.TArea;
import com.frank.easyexcel.respository.TAreaRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author 小石潭记
 * @date 2021/7/5 10:55
 * @Description: ${todo}
 */
@Service
public class AreaService {

    @Autowired
    private TAreaRepository tAreaRepository;

    @Autowired
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;

    public void saveArea(int i) {
        threadPoolTaskExecutor.submit(() -> {
            save(i);
        });
    }

    private void save(int i){
        /*TArea tArea = new TArea();
        tArea.setAreaName("北京" + i);
        tArea.setParentName("中国" + i);
        tArea.setParentId(i);
        tArea.setLevel("等级" + i);
        tAreaRepository.save(tArea);*/
    }

}
